<template>
  <el-col :span="span" :xs="spanMap.xs" :sm="spanMap.sm" :md="spanMap.md" :lg="spanMap.lg" :xl="spanMap.xl" class="descriptions-item" :class="right == 1 ? 'rightcol' : ''">
    <div class="descriptions-item-content">
      <div class="descriptions-item-label">{{ label }}</div>
      <div class="descriptions-item-value">
        <slot v-if="$slots.content" name="content" />
        <div v-else class="default-value" :title="value" style="margin-left:15px;">
          <div class="content" :class="span >= 15 ? 'active' : ''" v-if="!isInput">{{ value || $t('message.emptyData') }}</div>
          <el-input class="content_input" placeholder="请输入" clearable :value="value" v-model="value" v-if="isInput" />
        </div>
      </div>
    </div>
    <!-- <div class="descriptions-item-content" v-if="label == undefined" style="height: 50px;">
      <div class="descriptions-item-label">{{ label }}</div>
      <div class="descriptions-item-value">
        
      </div>
    </div> -->
  </el-col>
</template>

<script>
export default {
  name: 'ElDescriptionItem',
  props: {
    spanMap: {
      type: Object,
      required: false,
      default: () => {
        return {};
      },
    },
    span: {
      type: Number,
      required: false,
      default: 6,
    },
    right: {
      type: Number,
      required: false,
      default: 0,
    },
    label: {
      required: true,
    },
    value: {
      required: false,
      default() {
        return '';
      },
    },
    isInput: {
      type: Boolean,
      required: false,
      default: 0,
    },
  },
};
</script>

<style scoped>
.descriptions-item {
  padding-bottom: 16px;
  padding-right: 20px;
}
.descriptions-item span {
  display: inline-block;
}
.descriptions-item-content {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  color: rgba(0, 0, 0, 0.65);
  font-size: 14px;
  line-height: 1.5;
  width: 100%;
}
.descriptions-item-label {
  flex-grow: 0;
  flex-shrink: 0;
  color: rgba(0, 0, 0, 0.85);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
}
.descriptions-item-value {
  flex-grow: 1;
  overflow: hidden;
  /* .default-value{
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        } */
}
/* .default-value{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 200px;
  }      */
.descriptions-item .descriptions-item-content .descriptions-item-value .default-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}
.descriptions-item .descriptions-item-content .descriptions-item-label {
  -webkit-box-flex: 0;
  -ms-flex-positive: 0;
  flex-grow: 0;
  -ms-flex-negative: 0;
  flex-shrink: 0;
  color: rgba(0, 0, 0, 0.85);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  width: 80px;
  text-align: right;
  white-space: nowrap;
}
.content {
  background: #f5f7fa;
  border: 1px solid #ebeef5;
  border-radius: 3px;
  padding: 5px 8px;
  min-width: 100%;
  position: relative;
  display: inline-block;
}
.content_input {
  padding: 5px 8px;
  min-width: 100%;
  position: relative;
  display: inline-block;
}
.active {
  min-width: 54%;
}
.rightcol {
  margin-right: 30%;
  display: block;
}
</style>
